package STUDENT.TRANBANGTUNG.day_05_04_2016;

import java.util.Scanner;

public class ngaycuathang {
	public static void main(String[] args) {
		String thang1;
		int ngay;
		String nam1;
		System.out.println("nhap thang ban muon xem ngay!");
		Scanner sc = new Scanner(System.in);
		thang1 = sc.next();
		if (thang1.isEmpty()) {
			System.out.println("vui long nhap thang vao!");
		} else {
			int thang = Integer.parseInt(thang1);
			if (thang == 4 || thang == 6 || thang == 9 || thang == 11) {
				ngay = 30;
				System.out.println("thang " + thang + " co " + ngay);
			} else if (thang == 2) {
				System.out.println("vui long nhap nam cua thang 2!");
				Scanner scnam = new Scanner(System.in);
				nam1 = scnam.next();
				int nam = Integer.parseInt(nam1);
				if (nam1.isEmpty()) {
					System.out.println("vui long nhap nam!");
				} else if (nam % 400 == 0 || nam % 4 == 0 && nam % 100 != 0) {
					ngay = 29;
					System.out.println("thang 2 nam " + nam + " co " + ngay);
				} else {
					ngay = 28;
					System.out.println("thang 2 nam " + nam + " co " + ngay);
				}

			} else {
				ngay = 31;
				System.out.println("thang " + thang + " co " + ngay);
			}
		}
	}
}
